package com.example.spring.mapper;

import com.example.spring.pojo.Library;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface LibraryMapper {

    List<Library> selectLibrary();

    Library queryLibrary(@Param("libraryId") Integer libraryId);

    @Update("update t_library set position=#{position} where id=#{id}")
    Integer updateLibrary(@Param("position") String position, @Param("id") Integer id);

    @Select("select * from t_library where id = #{id}")
    Library getLibrary(@Param("id") Integer id);

    @Insert("insert t_library (name,age,address,position) values (#{library.name},#{library.age},#{library.address},#{library.position})")
    Integer addLibrary(@Param("library") Library library);

    @Delete("delete from t_library where id = #{id}")
    Integer deleteLibrary(@Param("id") Integer id);

}
